﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Acme.BookStore2.Migrations
{
    public partial class driverecord : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_VehicleDriveRecords",
                table: "VehicleDriveRecords");

            migrationBuilder.RenameTable(
                name: "VehicleDriveRecords",
                newName: "AppVehicleDriveRecord");

            migrationBuilder.AddColumn<DateTime>(
                name: "DriveTime",
                table: "AppVehicleDriveRecord",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<Guid>(
                name: "Driver",
                table: "AppVehicleDriveRecord",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<string>(
                name: "Remark",
                table: "AppVehicleDriveRecord",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "VehicleId",
                table: "AppVehicleDriveRecord",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddPrimaryKey(
                name: "PK_AppVehicleDriveRecord",
                table: "AppVehicleDriveRecord",
                column: "Id");

            migrationBuilder.CreateIndex(
                name: "IX_AppVehicleDriveRecord_VehicleId",
                table: "AppVehicleDriveRecord",
                column: "VehicleId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_AppVehicleDriveRecord",
                table: "AppVehicleDriveRecord");

            migrationBuilder.DropIndex(
                name: "IX_AppVehicleDriveRecord_VehicleId",
                table: "AppVehicleDriveRecord");

            migrationBuilder.DropColumn(
                name: "DriveTime",
                table: "AppVehicleDriveRecord");

            migrationBuilder.DropColumn(
                name: "Driver",
                table: "AppVehicleDriveRecord");

            migrationBuilder.DropColumn(
                name: "Remark",
                table: "AppVehicleDriveRecord");

            migrationBuilder.DropColumn(
                name: "VehicleId",
                table: "AppVehicleDriveRecord");

            migrationBuilder.RenameTable(
                name: "AppVehicleDriveRecord",
                newName: "VehicleDriveRecords");

            migrationBuilder.AddPrimaryKey(
                name: "PK_VehicleDriveRecords",
                table: "VehicleDriveRecords",
                column: "Id");
        }
    }
}
